package com.bdqn.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;

/**
 * sys_user
 *
 * @author LILIBO
 * @since 2022-01-16
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Entity // 表示该实体是数据库表映射的实体
@Table(name = "sys_user") // 对应的表名
@NamedQueries(@NamedQuery(name = "User.findUsersByName", query = "select u from User u where u.usrName = ?1"))
public class User implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 编号
	 */
	@Id // 该字段是主键字段
	@GeneratedValue(strategy = GenerationType.IDENTITY) // 主键生成策略
	@Column(name = "usr_id") // 该属性与表中usr_id字段对应
	private Long usrId;

	/**
	 * 姓名
	 */
	@Column(name = "usr_name")
	private String usrName;

	/**
	 * 密码
	 */
	@Column(name = "usr_password")
	private String usrPassword;

	/**
	 * 角色编号
	 */
	@Column(name = "usr_role_id")
	private Long usrRoleId;

	/**
	 * 状态
	 */
	@Column(name = "usr_flag")
	private Long usrFlag;

	// @Transient // 表示该属性不是数据库字段
	// private String queryName;

	public User(String usrName, String usrPassword, Long usrRoleId, Long usrFlag) {
		this.usrName = usrName;
		this.usrPassword = usrPassword;
		this.usrRoleId = usrRoleId;
		this.usrFlag = usrFlag;
	}
}
